package com.example.perplonews.a_d_fragment.a_news.adapter

import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.perplonews.R
import com.example.perplonews.a_b_entity.TextBannerEntity
import com.example.perplonews.a_b_utils.LjlUtils
import com.youth.banner.adapter.BannerAdapter
import com.youth.banner.util.BannerUtils

class TextBannerAdapter : BannerAdapter<TextBannerEntity.Values,TextBannerAdapter.TextBannerHolder> {
    constructor(data:ArrayList<TextBannerEntity.Values>) : super(data) {

    }


    override fun onCreateHolder(parent: ViewGroup, viewType: Int): TextBannerHolder {
        return  TextBannerHolder(BannerUtils.getView(parent,R.layout.item_news_text))
    }

    override fun onBindView(
        holder: TextBannerHolder,
        data: TextBannerEntity.Values,
        position: Int,
        size: Int
    ) {
//        LjlUtils.Ljl_Loge(""+data.news_title)
        if (data == null){
         holder.title?.setText("热门正在产生~~~~~")
        }
        holder.title?.setText(""+data.news_title)

    }
    class TextBannerHolder : RecyclerView.ViewHolder {
        var title:TextView?= null

        constructor(itemView: View) : super(itemView) {
            title = itemView.findViewById(R.id.news_text_title)
        }

    }
}